﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Microsoft.Windows.Controls.Ribbon;
using System.Windows.Media.Imaging;

namespace ActiveStory.UI.Commands
{
    public class RibbonUICommands
    {
        static RibbonUICommands()
        {
            InputGestureCollection inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.N, ModifierKeys.Control, "Ctrl+N"));
            _newProject = new RibbonCommand("NewProject", typeof(RibbonUICommands), inputKeys);
            _newProject.LabelTitle = "New Project";
            _newProject.ToolTipTitle = "Create a New Project";
            _newProject.ToolTipDescription = "Create a new ActiveStory project.";
            _newProject.SmallImageSource = new BitmapImage(new Uri("../Content/NewProject.png", UriKind.Relative));
            _newProject.LargeImageSource = new BitmapImage(new Uri("../Content/NewProject.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.O, ModifierKeys.Control, "Ctrl+O"));
            _openProject = new RibbonCommand("OpenProject", typeof(RibbonUICommands), inputKeys);
            _openProject.LabelTitle = "Open Project";
            _openProject.ToolTipTitle = "Open a Project";
            _openProject.ToolTipDescription = "Open an existing ActiveStory project.";
            _openProject.SmallImageSource = new BitmapImage(new Uri("../Content/OpenProject.png", UriKind.Relative));
            _openProject.LargeImageSource = new BitmapImage(new Uri("../Content/OpenProject.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.S, ModifierKeys.Control, "Ctrl+S"));
            _saveProject = new RibbonCommand("SaveProject", typeof(RibbonUICommands), inputKeys);
            _saveProject.LabelTitle = "Save Project";
            _saveProject.ToolTipTitle = "Save the Project";
            _saveProject.ToolTipDescription = "Save the current ActiveStory project.";
            _saveProject.SmallImageSource = new BitmapImage(new Uri("../Content/Save.png", UriKind.Relative));
            _saveProject.LargeImageSource = new BitmapImage(new Uri("../Content/Save.png", UriKind.Relative));

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.E, ModifierKeys.Control, "Ctrl+E"));
            _exportProject = new RibbonCommand("ExportProject", typeof(RibbonUICommands), inputKeys);
            _exportProject.LabelTitle = "Export";
            _exportProject.ToolTipTitle = "Export the Project";
            _exportProject.ToolTipDescription = "Export the current ActiveStory project.";
            _exportProject.SmallImageSource = new BitmapImage(new Uri("../Content/export_img.png", UriKind.Relative));
            _exportProject.LargeImageSource = new BitmapImage(new Uri("../Content/export_img.png", UriKind.Relative));

            _exportPageToImage = new RibbonCommand("ExportPageToImage", typeof(RibbonUICommands));
            _exportPageToImage.LabelTitle = "Current Page To Image";
            _exportPageToImage.ToolTipTitle = "Export the Page";
            _exportPageToImage.ToolTipDescription = "Export the current page to an image file.";
            _exportPageToImage.SmallImageSource = new BitmapImage(new Uri("../Content/ExportPageAsImage.png", UriKind.Relative));
            _exportPageToImage.LargeImageSource = new BitmapImage(new Uri("../Content/ExportPageAsImage.png", UriKind.Relative));
            
            _exportAllToImage = new RibbonCommand("ExportAllToImage", typeof(RibbonUICommands));
            _exportAllToImage.LabelTitle = "All Pages To Images";
            _exportAllToImage.ToolTipTitle = "Export All Pages";
            _exportAllToImage.ToolTipDescription = "Export all pages to images.";
            _exportAllToImage.SmallImageSource = new BitmapImage(new Uri("../Content/ExportAllPages.png", UriKind.Relative));
            _exportAllToImage.LargeImageSource = new BitmapImage(new Uri("../Content/ExportAllPages.png", UriKind.Relative));
            
            _exportToWizardOfOz = new RibbonCommand("ExportToWizardOfOz", typeof(RibbonUICommands));
            _exportToWizardOfOz.LabelTitle = "To Wizard of Oz Tool";
            _exportToWizardOfOz.ToolTipTitle = "Export To Wizard of Oz Tool";
            _exportToWizardOfOz.ToolTipDescription = "Export the current ActiveStory project to the Wizard of Oz Tool.";
            _exportToWizardOfOz.SmallImageSource = new BitmapImage(new Uri("../Content/wizard.png", UriKind.Relative));
            _exportToWizardOfOz.LargeImageSource = new BitmapImage(new Uri("../Content/wizard.png", UriKind.Relative));

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.Q, ModifierKeys.Control, "Ctrl+Q"));
            inputKeys.Add(new KeyGesture(Key.X, ModifierKeys.Alt, "Alt+X"));
            _exitActiveStory = new RibbonCommand("Exit", typeof(RibbonUICommands), inputKeys);
            _exitActiveStory.LabelTitle = "Exit";
            _exitActiveStory.ToolTipTitle = "Exit";
            _exitActiveStory.ToolTipDescription = "Exit ActiveStory Enhanced";
            _exitActiveStory.SmallImageSource = new BitmapImage(new Uri("../Content/CloseButton.png", UriKind.Relative));
            _exitActiveStory.LargeImageSource = new BitmapImage(new Uri("../Content/CloseButton.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.D, ModifierKeys.Control, "Ctrl+D"));
            _drawMode = new RibbonCommand("DrawMode", typeof(RibbonUICommands), inputKeys);
            _drawMode.LabelTitle = "Draw";
            _drawMode.ToolTipTitle = "Draw Mode";
            _drawMode.ToolTipDescription = "Activate draw mode.";
            _drawMode.SmallImageSource = new BitmapImage(new Uri("../Content/pen_img.png", UriKind.Relative));
            _drawMode.LargeImageSource = new BitmapImage(new Uri("../Content/pen_img.png", UriKind.Relative));

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.P, ModifierKeys.Control, "Ctrl+P"));
            _pointEraserMode = new RibbonCommand("PointEraser", typeof(RibbonUICommands), inputKeys);
            _pointEraserMode.LabelTitle = "Point Eraser";
            _pointEraserMode.ToolTipTitle = "Point Eraser Mode";
            _pointEraserMode.ToolTipDescription = "Erase lines point-by-point.";
            _pointEraserMode.SmallImageSource = new BitmapImage(new Uri("../Content/PointEraser.png", UriKind.Relative));
            _pointEraserMode.LargeImageSource = new BitmapImage(new Uri("../Content/PointEraser.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.K, ModifierKeys.Control, "Ctrl+K"));
            _strokeEraserMode = new RibbonCommand("StrokeEraser", typeof(RibbonUICommands), inputKeys);
            _strokeEraserMode.LabelTitle = "Stroke Eraser";
            _strokeEraserMode.ToolTipTitle = "Stroke Eraser Mode";
            _strokeEraserMode.ToolTipDescription = "Erase lines stroke-by-stroke.";
            _strokeEraserMode.SmallImageSource = new BitmapImage(new Uri("../Content/StrokeEraser.png", UriKind.Relative));
            _strokeEraserMode.LargeImageSource = new BitmapImage(new Uri("../Content/StrokeEraser.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.T, ModifierKeys.Control, "Ctrl+T"));
            _selectionMode = new RibbonCommand("SelectionMode", typeof(RibbonUICommands), inputKeys);
            _selectionMode.LabelTitle = "Selection";
            _selectionMode.ToolTipTitle = "Selection Mode";
            _selectionMode.ToolTipDescription = "Select strokes, images or links and delete, resize or copy them. Select by clicking on the element or by lassoing multiple elements.";
            _selectionMode.SmallImageSource = new BitmapImage(new Uri("../Content/Selection.png", UriKind.Relative));
            _selectionMode.LargeImageSource = new BitmapImage(new Uri("../Content/Selection.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.L, ModifierKeys.Control, "Ctrl+L"));
            _createLink = new RibbonCommand("CreateLink", typeof(RibbonUICommands), inputKeys);
            _createLink.LabelTitle = "Create Link";
            _createLink.ToolTipTitle = "Create Link Mode";
            _createLink.ToolTipDescription = "Create links to other pages. Click and drag the area where you want to create the link after enabling create link mode.";
            _createLink.SmallImageSource = new BitmapImage(new Uri("../Content/CreateLink.png", UriKind.Relative));
            _createLink.LargeImageSource = new BitmapImage(new Uri("../Content/CreateLink.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.R, ModifierKeys.Control, "Ctrl+R"));
            _removeLink = new RibbonCommand("RemoveLink", typeof(RibbonUICommands), inputKeys);
            _removeLink.LabelTitle = "Remove Link";
            _removeLink.ToolTipTitle = "Remove Mode";
            _removeLink.ToolTipDescription = "Remove links to other pages. Click on the link that you want to remove after enabling remove link mode.";
            _removeLink.SmallImageSource = new BitmapImage(new Uri("../Content/RemoveLink.png", UriKind.Relative));
            _removeLink.LargeImageSource = new BitmapImage(new Uri("../Content/RemoveLink.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.I, ModifierKeys.Control, "Ctrl+I"));
            _importImage = new RibbonCommand("ImportImage", typeof(RibbonUICommands), inputKeys);
            _importImage.LabelTitle = "Import Image";
            _importImage.ToolTipTitle = "Import an Image";
            _importImage.ToolTipDescription = "Import an existing image into this page. You can resize the image and move it after importing by switching to selection mode.";
            _importImage.SmallImageSource = new BitmapImage(new Uri("../Content/ImportImage.png", UriKind.Relative));
            _importImage.LargeImageSource = new BitmapImage(new Uri("../Content/ImportImage.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.A, ModifierKeys.Alt, "Alt+A"));
            _addPage = new RibbonCommand("AddPage", typeof(RibbonUICommands), inputKeys);
            _addPage.LabelTitle = "Add Page";
            _addPage.ToolTipTitle = "Add a Page";
            _addPage.ToolTipDescription = "Add a new page to the project.";
            _addPage.SmallImageSource = new BitmapImage(new Uri("../Content/AddPage.png", UriKind.Relative));
            _addPage.LargeImageSource = new BitmapImage(new Uri("../Content/AddPage.png", UriKind.Relative));
            
            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.D, ModifierKeys.Alt, "Alt+D"));
            _deletePage = new RibbonCommand("DeletePage", typeof(RibbonUICommands), inputKeys);
            _deletePage.LabelTitle = "Delete Page";
            _deletePage.ToolTipTitle = "Delete a Page";
            _deletePage.ToolTipDescription = "Deletes the current page from the project. Can not be undone.";
            _deletePage.SmallImageSource = new BitmapImage(new Uri("../Content/DeletePage.png", UriKind.Relative));
            _deletePage.LargeImageSource = new BitmapImage(new Uri("../Content/DeletePage.png", UriKind.Relative));

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.C, ModifierKeys.Alt, "Alt+C"));
            _carbonCopyPage = new RibbonCommand("CarbonCopyPage", typeof(RibbonUICommands), inputKeys);
            _carbonCopyPage .LabelTitle = "Carbon Copy Page";
            _carbonCopyPage .ToolTipTitle = "Carbon Copy this Page";
            _carbonCopyPage .ToolTipDescription = "Creates a carbon copy of this page and adds it to the project.";
            _carbonCopyPage.SmallImageSource = new BitmapImage(new Uri("../Content/CopyPage.png", UriKind.Relative));
            _carbonCopyPage.LargeImageSource = new BitmapImage(new Uri("../Content/CopyPage.png", UriKind.Relative));

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.R, ModifierKeys.Alt, "Alt+R"));
            _renamePage = new RibbonCommand("RenamePage", typeof(RibbonUICommands), inputKeys);
            _renamePage.LabelTitle = "Rename Page";
            _renamePage.ToolTipTitle = "Rename this Page";
            _renamePage.ToolTipDescription = "Rename the current page in the project.";
            _renamePage.SmallImageSource = new BitmapImage(new Uri("../Content/Rename.png", UriKind.Relative));
            _renamePage.LargeImageSource = new BitmapImage(new Uri("../Content/Rename.png", UriKind.Relative));

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.P, ModifierKeys.Alt, "Alt+P"));
            _setPenColor = new RibbonCommand("PenColor", typeof(RibbonUICommands), inputKeys);
            _setPenColor.LabelTitle = "Set Pen Color";
            _setPenColor.ToolTipTitle = "Set the Pen Color";
            _setPenColor.ToolTipDescription = "Sets the color of the drawing pen.";

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.S, ModifierKeys.Alt, "Alt+S"));
            _setCanvasSize = new RibbonCommand("CanvasSize", typeof(RibbonUICommands), inputKeys);
            _setCanvasSize.LabelTitle = "Set Canvas Size";
            _setCanvasSize.ToolTipTitle = "Set Canvas Size";
            _setCanvasSize.ToolTipDescription = "Set the size of the canvas for the current page.";

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.F1, ModifierKeys.Control, "Ctrl+F1"));
            _about = new RibbonCommand("About", typeof(RibbonUICommands), inputKeys);
            _about.LabelTitle = "About";
            _about.ToolTipTitle = "About ActiveStory Enhanced";
            _about.ToolTipDescription = "View the about dialog for ActiveStory Enhanced.";
            _about.SmallImageSource = new BitmapImage(new Uri("../Content/help.png", UriKind.Relative));
            _about.LargeImageSource = new BitmapImage(new Uri("../Content/help.png", UriKind.Relative));

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.Z, ModifierKeys.Control, "Ctrl+Z"));
            _undo = new RibbonCommand("Undo", typeof(RibbonUICommands), inputKeys);
            _undo.LabelTitle = "Undo";
            _undo.ToolTipTitle = "Undo Last Stroke";
            _undo.ToolTipDescription = "Undo the last stroke on the canvas.";
            _undo.SmallImageSource = new BitmapImage(new Uri("../Content/Undo.png", UriKind.Relative));
            _undo.LargeImageSource = new BitmapImage(new Uri("../Content/Undo.png", UriKind.Relative));

            inputKeys = new InputGestureCollection();
            inputKeys.Add(new KeyGesture(Key.Y, ModifierKeys.Control, "Ctrl+Y"));
            //inputKeys.Add(new KeyGesture(Key.Z, ModifierKeys.Control & ModifierKeys.Shift, "Ctrl+Shift+Z"));
            _redo = new RibbonCommand("Redo", typeof(RibbonUICommands), inputKeys);
            _redo.LabelTitle = "Redo";
            _redo.ToolTipTitle = "Redo Last Stroke";
            _redo.ToolTipDescription = "Redo the last stroke on the canvas.";
            _redo.SmallImageSource = new BitmapImage(new Uri("../Content/Redo.png", UriKind.Relative));
            _redo.LargeImageSource = new BitmapImage(new Uri("../Content/Redo.png", UriKind.Relative));

            _blueRibbon = new RibbonCommand("BlueRibbon", typeof(RibbonUICommands));
            _blueRibbon.LabelTitle = "Blue Office Ribbon";
            _blueRibbon.ToolTipTitle = "Blue Office Ribbon";
            _blueRibbon.ToolTipDescription = "Change the interface style to the Blue Office 2007 Ribbon.";

            _blackRibbon = new RibbonCommand("BlackRibbon", typeof(RibbonUICommands));
            _blackRibbon.LabelTitle = "Black Office Ribbon";
            _blackRibbon.ToolTipTitle = "Black Office Ribbon";
            _blackRibbon.ToolTipDescription = "Change the interface style to the Black Office 2007 Ribbon.";

            _silverRibbon = new RibbonCommand("SilverRibbon", typeof(RibbonUICommands));
            _silverRibbon.LabelTitle = "Silver Office Ribbon";
            _silverRibbon.ToolTipTitle = "Silver Office Ribbon";
            _silverRibbon.ToolTipDescription = "Change the interface style to the Silver Office 2007 Ribbon.";

            _win7Ribbon = new RibbonCommand("Win7Ribbon", typeof(RibbonUICommands));
            _win7Ribbon.LabelTitle = "Windows 7 Ribbon";
            _win7Ribbon.ToolTipTitle = "Windows 7 Ribbon";
            _win7Ribbon.ToolTipDescription = "Change the interface style to the Windows 7 Ribbon.";

            _noRibbon = new RibbonCommand("NoRibbon", typeof(RibbonUICommands));
            _noRibbon.LabelTitle = "Standard Style";
            _noRibbon.ToolTipTitle = "Standard Style";
            _noRibbon.ToolTipDescription = "Change the interface style to the standard (non-ribbon) style.";

            _leftyMode = new RibbonCommand("LeftyMode", typeof(RibbonUICommands));
            _leftyMode.LabelTitle = "Left Handed Interface";
            _leftyMode.ToolTipTitle = "Left Handed Interface";
            _leftyMode.ToolTipDescription = "Change the interface to left-handed user friendly mode.";
            _leftyMode.SmallImageSource = new BitmapImage(new Uri("../Content/LeftHand.png", UriKind.Relative));
            _leftyMode.LargeImageSource = new BitmapImage(new Uri("../Content/LeftHand.png", UriKind.Relative));

            _changeDefaultCanvasColor = new RibbonCommand("ChangeDefaultCanvasColor", typeof(RibbonUICommands));
            _changeDefaultCanvasColor.LabelTitle = "Default Canvas Color";
            _changeDefaultCanvasColor.ToolTipTitle = "Change Default Canvas Color";
            _changeDefaultCanvasColor.ToolTipDescription = "Change the default color for the canvas.";

            _changeCurrentCanvasColor = new RibbonCommand("ChangeCurrentCanvasColor", typeof(RibbonUICommands));
            _changeCurrentCanvasColor.LabelTitle = "Canvas Color";
            _changeCurrentCanvasColor.ToolTipTitle = "Change Current Canvas Color";
            _changeCurrentCanvasColor.ToolTipDescription = "Change the color for the current canvas.";

        }

        private static RibbonCommand _newProject;

        private static RibbonCommand _openProject;

        private static RibbonCommand _saveProject;

        private static RibbonCommand _exportProject;

        private static RibbonCommand _exportPageToImage;

        private static RibbonCommand _exportAllToImage;

        private static RibbonCommand _exportToWizardOfOz;

        private static RibbonCommand _exitActiveStory;

        private static RibbonCommand _drawMode;

        private static RibbonCommand _pointEraserMode;

        private static RibbonCommand _strokeEraserMode;

        private static RibbonCommand _selectionMode;

        private static RibbonCommand _createLink;

        private static RibbonCommand _removeLink;

        private static RibbonCommand _importImage;

        private static RibbonCommand _addPage;

        private static RibbonCommand _deletePage;

        private static RibbonCommand _carbonCopyPage;

        private static RibbonCommand _renamePage;

        private static RibbonCommand _setPenColor;

        private static RibbonCommand _setCanvasSize;

        private static RibbonCommand _about;

        private static RibbonCommand _undo;
        
        private static RibbonCommand _redo;

        private static RibbonCommand _blueRibbon;

        private static RibbonCommand _blackRibbon;

        private static RibbonCommand _silverRibbon;

        private static RibbonCommand _win7Ribbon;
        
        private static RibbonCommand _noRibbon;

        private static RibbonCommand _leftyMode;

        private static RibbonCommand _changeDefaultCanvasColor;

        private static RibbonCommand _changeCurrentCanvasColor;

        public static RibbonCommand NewProject
        {
            get
            {
                return _newProject;
            }
        }

        public static RibbonCommand OpenProject
        {
            get
            {
                return _openProject;
            }
        }

        public static RibbonCommand SaveProject
        {
            get
            {
                return _saveProject;
            }
        }

        public static RibbonCommand ExportProject
        {
            get
            {
                return _exportProject;
            }
        }

        public static RibbonCommand ExportPageToImage
        {
            get
            {
                return _exportPageToImage;
            }
        }

        public static RibbonCommand ExportAllToImage
        {
            get
            {
                return _exportAllToImage;
            }
        }

        public static RibbonCommand ExportToWizardOfOz
        {
            get
            {
                return _exportToWizardOfOz;
            }
        }

        public static RibbonCommand ExitActiveStory
        {
            get
            {
                return _exitActiveStory;
            }
        }

        public static RibbonCommand DrawMode
        {
            get
            {
                return _drawMode;
            }
        }

        public static RibbonCommand PointEraserMode
        {
            get
            {
                return _pointEraserMode;
            }
        }

        public static RibbonCommand StrokeEraserMode
        {
            get
            {
                return _strokeEraserMode;
            }
        }

        public static RibbonCommand SelectionMode
        {
            get
            {
                return _selectionMode;
            }
        }

        public static RibbonCommand CreateLink
        {
            get
            {
                return _createLink;
            }
        }

        public static RibbonCommand RemoveLink
        {
            get
            {
                return _removeLink;
            }
        }

        public static RibbonCommand ImportImage
        {
            get
            {
                return _importImage;
            }
        }

        public static RibbonCommand AddPage
        {
            get
            {
                return _addPage;
            }
        }

        public static RibbonCommand DeletePage
        {
            get
            {
                return _deletePage;
            }
        }

        public static RibbonCommand CarbonCopyPage
        {
            get
            {
                return _carbonCopyPage;
            }
        }

        public static RibbonCommand RenamePage
        {
            get
            {
                return _renamePage;
            }
        }

        public static RibbonCommand SetPenColor
        {
            get
            {
                return _setPenColor;
            }
        }

        public static RibbonCommand SetCanvasSize
        {
            get
            {
                return _setCanvasSize;
            }
        }

        public static RibbonCommand About
        {
            get
            {
                return _about;
            }
        }

        public static RibbonCommand Undo
        {
            get
            {
                return _undo;
            }
        }

        public static RibbonCommand Redo
        {
            get
            {
                return _redo;
            }
        }

        public static RibbonCommand BlueRibbon
        {
            get
            {
                return _blueRibbon;
            }
        }

        public static RibbonCommand BlackRibbon
        {
            get
            {
                return _blackRibbon;
            }
        }

        public static RibbonCommand SilverRibbon
        {
            get
            {
                return _silverRibbon;
            }
        }

        public static RibbonCommand Win7Ribbon
        {
            get
            {
                return _win7Ribbon;
            }
        }

        public static RibbonCommand NoRibbon
        {
            get
            {
                return _noRibbon;
            }
        }

        public static RibbonCommand LeftyMode
        {
            get
            {
                return _leftyMode;
            }
        }

        public static RibbonCommand ChangeDefaultCanvasColor
        {
            get
            {
                return _changeDefaultCanvasColor;
            }
        }

        public static RibbonCommand ChangeCurrentCanvasColor
        {
            get
            {
                return _changeCurrentCanvasColor;
            }
        }
    }
}
